<?php

namespace app\api\service;

use app\common\model\ShortUrlModel;
use Php127\Douyin\Factory;

class ShortUrlService extends CommonService
{
    protected string $ShortUrl = '';

    public function __construct()
    {
        $this->ShortUrl = env('short_url')??'';
    }

    public function getDyVideo(array $params,string $playUrl = '')
    {
        $app = Factory::douyin($playUrl);
        $data = $app->getData();
        $str = md5($data['url']);
        (new ShortUrlModel())->setShortData($data['url'],$str,$params['robot_wxid'],$data['title']);
        $this->send_link_msg($params['robot_wxid'],$params['from_wxid'],$data['title'],
            "点赞量:".$data['digg_count']."\n评论量:".$data['comment_count'],env('short_url').$str,$data['img'],$data['img']);
        exit();

    }




}